CREATE TABLE [dbo].[TCREPO]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[NU_ANNO] [dbo].[TD_IN_004_ANNO] NOT NULL CONSTRAINT [DF__TCREPO__NU_ANNO__5165187F] DEFAULT (datepart(year,getdate())),
[CO_REPO] [dbo].[TD_VC_003] NOT NULL,
[DE_REPO] [dbo].[TD_VC_100] NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TCREPO__FE_USUA___534D60F1] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TCREPO__FE_USUA___5441852A] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TCREPO] ADD CONSTRAINT [CK__TCREPO__NU_ANNO__52593CB8] CHECK (([NU_ANNO]>=(0)))
GO
ALTER TABLE [dbo].[TCREPO] ADD CONSTRAINT [XPKTCREPO] PRIMARY KEY CLUSTERED  ([CO_EMPR], [NU_ANNO], [CO_REPO]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TCREPO] ADD CONSTRAINT [FK1_TMPARA_CONT_A_TCREPO] FOREIGN KEY ([CO_EMPR]) REFERENCES [dbo].[TMPARA_CONT] ([CO_EMPR])
GO
